

<template >
<div @click="onClick">
  数字
  {{ count }}
    </div>
</template> 

<script>
import { defineComponent, ref, onMounted, reactive, watch } from "vue";
  export default defineComponent({
    name: "Test",
    components: {
    },
    props: {
    
    },
    emits: ['click'],
    setup(props, {attrs, slots, emit}) {
      let a = ref(0)
      let count = ref(0)
      const onClick = (e) => {
        count.value++
        console.log(count.value, '2222')
      }

      watch(() => count.value, newVal => {
        console.log('监听', newVal)
      }, { immediate: true })


onMounted(() => {
  console.log('组件')
  count.value++
})

      

      return {
        onClick,
        a,
        count,
        array: ['美国', '中国', '巴西', '日本']
      }
    }
  });
</script>

<style scoped>

</style>